import base64
import os
fpath = os.listdir()
for i in fpath:
    if os.path.isdir(i):
        pass
    elif os.path.splitext(i)[1] == '.jpg':
        print(i,end=' ==> ')
        photo = open(i,'rb')
        wjmkz = os.path.splitext(i)
        a = open(r'%s.h'%wjmkz[0],'a')
        a.write(wjmkz[1]+'\n')
        for letters in photo.readlines():
            e = base64.b64encode(letters)
            a.write(e.decode())
            a.write('\n')
        photo.close()
        a.close()
        os.remove(i)
        print('%s.h'%wjmkz[0])